home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Directorty Opus 5 - Magellan
/
Opus 5 - Magellan.iso
/
Extras
/
Install_3.3
/
ARexx
/
Install_Startup.dopus5
< prev
next >
Wrap
Text File
|
1997-05-09
|
9KB
|
377 lines
/* $VER: Install_Startup.dopus5 3.1 (09.05.97) © Frédéric Steinfels
*/
signal on BREAK_C
signal on BREAK_D
signal on BREAK_E
signal on BREAK_F
signal on HALT
signal on IOERR
signal on SYNTAX
signal on FAILURE
options failat 21
options results
parse arg arguments
Call Init
address value PORT
MYPORT='DOINST.'
prgcnt=1
do while POS(MYPORT||prgcnt,SHOW('p'))~=0
prgcnt=prgcnt+1
end
MYPORT=MYPORT||prgcnt
MYPORTH=openport(MYPORT)
MNPORT='DOINMN.'||prgcnt
SSPORT='DOINSS.'||prgcnt
SDPORT='DOINSD.'||prgcnt
VSPORT='DOINVS.'||prgcnt
VDPORT='DOINVD.'||prgcnt
RQPORT='DOINRQ.'||prgcnt
EXPORT='DOINEX.'||prgcnt
say GetCatStr(20,'Version Installation Program for Directory Opus Magellan')
say GetCatStr(21,'Written by Frederic Steinfels, fsteinfe@iiic.ethz.ch')
Call CheckDate
srch=SOURCEHANDLE
if srch=0 THEN DO
dopus request '"' || GetCatStr(22,'No source lister') || '"' GetCatStr(0,'Abort')
call CleanUP
exit
end
dsth=DESTINATIONHANDLE
if (dsth=srch | dsth=0) & (symbol('DESTINATION')='LIT') THEN do
dopus request '"' || GetCatStr(23,'No destination lister') || '"' GetCatStr(0,'Abort')
call CleanUP
exit
end
lister query srch path
srcp=result
if ~exists(srcp) | symbol('result')='LIT' then do
dopus request '"' || GetCatStr(24,'Source path not valid') || '"' GetCatStr(0,'Abort')
call CleanUP
exit
end
if symbol('DESTINATION')='LIT' then do
lister query dsth path
dstp=result
if ~exists(dstp) | symbol('result')='LIT' then do
dopus request '"' || GetCatStr(25,'Destination path not valid') || '"' GetCatStr(0,'Abort')
call CleanUP
exit
end
end
else do
dsth=srch
dstp=DESTINATION
end
dstp=AbsolutePath(dstp)
srcp=AbsolutePath(srcp)
if UPPER(dstp)=UPPER(srcp) then do
dopus request '"' || GetCatStr(26,'Destination must be different to source') || '"' GetCatStr(0,'Abort')
call CleanUP
exit
end
lister query srch numselentries
if symbol('result')='LIT' then result=0
nums=result
lister query dsth numselentries
if symbol('result')='LIT' then result=0
numd=result
if nums=0 & numd=0 & SYMBOL('FILE')='LIT' then do
dopus request '"' || GetCatStr(27,'Nothing selected') || '"' GetCatStr(0,'Abort')
call CleanUP
exit
end
lister query srch position
parse var result x "/" y "/" w "/" h " " .
lister new x"/"y"/"w"/"h
nsrch=result
lister wait nsrch quick
lister set nsrch visible 0
lister read nsrch '"' || srcp || '"' force
lister set nsrch mode name
lister set nsrch off
lister set nsrch lock state on format on
lister wait nsrch quick
command source nsrch dest nsrch wait NONE
lister query dsth position
parse var result x "/" y "/" w "/" h " " .
lister new x"/"y"/"w"/"h
ndsth=result
lister wait ndsth quick
lister set ndsth visible 0
lister read ndsth '"' || dstp || '"' force
lister wait ndsth quick
lister set ndsth mode name
lister set ndsth off
lister set ndsth lock state on format on
lister wait ndsth quick
command source ndsth dest ndsth wait NONE
if symbol('FILE')='VAR' then do
lister select nsrch FILE 1
lister select ndsth FILE 1
end
else do
do while nums>0
lister query srch firstsel
dat=result
lister select srch dat 0
lister wait srch quick
lister select nsrch dat 1
lister wait nsrch quick
lister select ndsth dat 1
lister wait ndsth quick
nums=nums-1
end
end
if symbol('DESTINATION')='LIT' then do
do while numd>0
lister query dsth firstsel
dat=result
lister select dsth dat 0
lister wait dsth quick
lister select ndsth dat 1
lister wait ndsth quick
lister select nsrch dat 1
lister wait nsrch quick
numd=numd-1
end
end
lister refresh nsrch full
lister refresh srch full
lister refresh ndsth full
lister refresh dsth full
address command 'resident c:version pure'
address command 'resident c:delete pure'
address REXX 'DOpus5:Arexx/Install_Main.dopus5' PORT nsrch ndsth prgcnt '"' || PREFSFILE || '"'
Call CleanUP
address command 'ask "' || GetCatStr(28,'Press enter, return or close button to continue.') || '"'
exit
CleanUp:
Call WriteCh('CON',GetCatStr(56,'Waiting for subtasks') || ' ')
do while POS(MNPORT,SHOW('p'))~=0 | POS(SSPORT,SHOW('p'))~=0 | POS(SDPORT,SHOW('p'))~=0 | POS(VSPORT,SHOW('p'))~=0 | POS(VDPORT,SHOW('p'))~=0 | POS(RQPORT,SHOW('p'))~=0 | POS(EXPORT,SHOW('p'))~=0
Call WriteCh('CON','.')
Call Delay(25)
end
if symbol('nsrch') = 'VAR' then do
lister close nsrch
end
if symbol('ndsth') = 'VAR' then do
lister close ndsth
end
Call WriteLn('CON',' ' || GetCatStr(58,'finished'))
if POS(MYPORT,SHOW('p'))~=0 then do
Call FORBID()
Call ClosePort(MYPORTH)
Call PERMIT()
end
call CloseCatalog(catalog)
Call Close('CON')
return
ERROR:
HALT:
IOERR:
SYNTAX:
IF RC ~= 0 THEN DO
line=sigl
text=errortext(rc)
dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || lf || text || lf || GetCatStr(19,'Line') line || '"' GetCatStr(0,'Abort')
END
else do
dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || '"' GetCatStr(0,'Abort')
end
BREAK_C:
BREAK_D:
BREAK_E:
BREAK_F:
Call CleanUP
exit
Init:
libname = "rexxdossupport.library"
if ~show("L", libname) then do
if ~addlib(libname, 0, -30, 2) then do
say libname "not added!"
exit
end
end
libname = "rexxtricks.library"
if ~show("L", libname) then do
if ~addlib(libname, 0, -30) then do
say libname "not added!"
exit
end
end
libname = "rexxsupport.library"
if ~show("L", libname) then do
if ~addlib(libname, 0, -30) then do
say libname "not added!"
exit
end
end
libname = "locale.library"
if ~show("L", libname) then do
if ~addlib(libname, 0, -30) then do
say libname "not added!"
exit
end
end
ProgramName = "Install_Startup.dopus5";
ArgsTemplate = "PORT/A,SOURCEHANDLE/A,DESTINATIONHANDLE/A,PREFSFILE/A,FILE,DESTINATION"
lf='0a'x
if strip(arguments) = '?' then do
Call WriteCh(STDOUT, ArgsTemplate || ': ')
pull arguments
end; else nop
if ~ReadArgs(arguments,ArgsTemplate) then do
say Fault(RC,ProgramName)
exit 10
end; else nop
drop arguments
inlocpr='DOpus5:System/Install_Locale.prefs'
catalog=opencatalog('Install.dopus5.catalog','english',0)
if ~open('CON','CONSOLE:','WRITE') then do
dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || lf || GetCatStr(15,'Unable to open') 'CONSOLE:' || '"' GetCatStr(0,'Abort')
call CleanUP
Exit
end
return
CheckDate:
if exists(inlocpr) then do
if ~open(lp,inlocpr,'READ') then do
dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || lf || GetCatStr(15,'Unable to open') inlocpr || '"' GetCatStr(0,'Abort')
Call CleanUP
exit
end
crc1=readln(lp)
Call Close(lp)
if exists('ENV:Sys/locale.prefs') then do
crc2=crc32('ENV:Sys/locale.prefs')
end
else do
crc2=0
end
if crc2~=crc1 then do
call UpdateDate
end
return
end
call UpdateDate
return
UpdateDate:
day=13
month=1
year=114
tr.0='.'
tr.1='-'
tr.2='/'
tr.3=' '
if ~open(lp,inlocpr,'WRITE') then do
dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || lf || GetCatStr(29,'Please start me later again.' || lf || 'Date Format update routine' || lf || 'cant be started twice.') || '"' GetCatStr(0,'Abort')
call CleanUP
exit
end
if exists('ENV:Sys/locale.prefs') then do
Call WriteLn(lp,crc32('ENV:Sys/locale.prefs'))
end
else do
Call WriteLn(lp,0)
end
do while month < 13
address command 'echo >T:VERTEST "$VER: x 0.0 (' || day || '.' || copies(0,2-length(month)) || month || '.' || year || ')"'
address command 'version >T:VERRES T:VERTEST FULL'
if open(ver,'T:VERRES','read') then do
ln=readln(ver)
Call Close(ver)
parse var ln '(' ln ')'
d.month.0=LENGTH(ln)
Call WriteLn(lp,d.month.0)
z=copies(' ',d.month.0)
cnt=0
d.tr=''
d.month.1=0
d.month.2=0
do until symbol('tr.cnt')='LIT'
if (length(ln)-2)=length(compress(ln,tr.cnt)) then do
d.month.1=POS(tr.cnt,ln)
z=OVERLAY('.',z,d.month.1,1)
d.month.2=POS(tr.cnt,ln,d.month.1+1)
z=OVERLAY('.',z,d.month.2,1)
d.tr=tr.cnt
end
cnt=cnt+1
end
Call WriteLn(lp,d.month.1)
Call WriteLn(lp,d.month.2)
d.month.3=POS(day,ln)
Call WriteLn(lp,d.month.3)
z=OVERLAY('..',z,d.month.3,2)
d.month.4=POS(year//100,ln)
Call WriteLn(lp,d.month.4)
z=OVERLAY('..',z,d.month.4,2)
d.month.5=POS(19+year%100,ln)
Call WriteLn(lp,d.month.5)
if d.month.5~=0 then do
z=OVERLAY('..',z,d.month.5,2)
end
d.month.6=POS(' ',z)
Call WriteLn(lp,d.month.6)
d.month.7=LASTPOS(' ',z)-d.month.6+1
Call WriteLn(lp,d.month.7)
d.month.8=SUBSTR(ln,d.month.6,d.month.7)
Call WriteLn(lp,d.month.8)
end
else do
dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || lf || GetCatStr(30,'Unable to open T:VERRES') || '"' GetCatStr(0,'Abort')
call CleanUP
exit
end
month=month+1
end
Call WriteLn(lp,d.tr)
Call Close(lp)
delete('T:VERTEST')
return
getcatstr: /* Thank you for this procedure, Edmund */
parse arg msgno,msgstring
if catalog~=0 then
msgstring=getcatalogstr(catalog,msgno,msgstring)
do i=3 to arg()
parse var msgstring fore '%s' aft
msgstring=fore||arg(i)||aft
end
return msgstring